home *** CD-ROM | disk | FTP | other *** search
- /*
- * aoi_io.c
- *
- * Practical Algorithms for Image Analysis
- *
- * Copyright (c) 1997, 1998, 1999 MLMSoftwareGroup, LLC
- */
-
- /*
- * AOI_IO.C
- *
- * routine to write aoi data to file
- *
- */
- #include "xah.h"
-
- #define SAR "area"
- #define SRD "radius"
-
- /* global */
- char *DTYPE;
-
- /*
- * write data to file
- */
- void
- write_bub_data (FILE * fpOut, float foo, int np, struct bubble *cbub, int nd)
- {
- int ip, id;
-
- fprintf (fpOut, "%d %d\n", nd, np);
- for (ip = 0; ip < np; ip++)
- fprintf (fpOut, "%f\n", foo);
-
- for (id = 0; id < nd; id++)
- fprintf (fpOut, "%3d %3d %ld\n", (int) (cbub + id)->ctr.x,
- (int) (cbub + id)->ctr.y, (long) (cbub + id)->area);
-
- }
-
-
-
- void
- write_aoi_data (FILE * fpOut, float foo, int np, struct Histo *h, int X_SQ)
- {
- int ib, ip;
-
- fprintf (fpOut, "%d %d\n", h->nb, np);
- for (ip = 0; ip < np; ip++)
- fprintf (fpOut, "%f\n", foo);
-
- for (ib = 0; ib < h->nb; ib++)
- fprintf (fpOut, "%f %f\n", (float) (ib + 1), h->ph[ib]);
-
- /*
- * following entries not read by fitting routine
- */
- fprintf (fpOut, "\n...stats:\n");
- fprintf (fpOut, " no of domains: %d\n", h->nh);
- fprintf (fpOut, " (raw) area mean, rmsq, skew: %lf %lf %lf\n",
- h->mean, h->sdev, h->skew);
-
- if (X_SQ == 1)
- DTYPE = SRD;
- else
- DTYPE = SAR;
-
- fprintf (fpOut, " minimum %s: %f\n", DTYPE, h->amin);
- fprintf (fpOut, " maximum %s: %f\n", DTYPE, h->amax);
- fprintf (fpOut, "%s_bin_width: %f\n", DTYPE, h->bw);
- fprintf (fpOut, " hist mean: %f\n", (float) h->hmean);
- fprintf (fpOut, "binning method: %d\n", h->meth);
-
- }
-